package com.alex.goods.service.impl;

import com.alex.goods.dao.AdminDao;
import com.alex.goods.entity.Admin;
import com.alex.goods.entity.Result;
import com.alex.goods.service.AdminService;

import java.util.List;

public class AdminServiceImpl implements AdminService {
	
	private AdminDao adminDao = new AdminDao();
	
	@Override
	public Boolean check(String username, String password) {
		 
		List<Admin> list = adminDao.selectByUsername(username);

		System.out.println(list);

		return list.size()>0 && list.get(0).getPassword().equals(password);
	}

//	public Result insertUser(String username, String password) {
//		return adminDao.insertUser(username, password);
//	}
//
//	@Override
//	public Result selectByUsernameIsHave(String username) {
//
//		return adminDao.selectByUsernameIsHave(username);
//	}

	@Override
	public Result selectByUsernameIsHaveOrInsert(String username, String password) {
		return adminDao.selectByUsernameIsHaveOrInsert(username, password);
	}

}
